<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>会员中心</title>
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
	<link rel="stylesheet" type="text/css" href="./css/my.css" />
	<style>
		.indexbanner {
			width: 100%;
			height: 100%;
			overflow: hidden;
			position: fixed;
			left: 0;
			top: 0;
			z-index: 9999999;
			background: rgba(51, 51, 51, 0.9);
			display: none;
		}

		.mask_close {
			width: 30px;
			height: 30px;
			position: fixed;
			right: 20px;
			top: 5%;
			z-index: 999992;
		}

		.mask_close img {
			width: 30px;
			height: 30px;
		}

		.contenttop_js {
			width: 100%;
			text-align: center;
			position: fixed;
			top: 50%;
			transform: translateY(-50%);
			z-index: 99999;
		}

		.share_photo {
			margin: 0 auto;
			width: 70%;
			height: auto;
			overflow: hidden;
		}

		.imgDetailBox {
			border-radius: 8px;
			background: #fff;
			padding: 5px;
		}

		.imgDetailBox img {
			width: 100%
		}
	</style>
</head>

<body class="my_bg">
	<div class="header_my_info " style="display:none">
		<div class="header_my_info_fl">
			<img id="avatar_t" src="./image/default_avatar.png">
			<span id="username_top">请登录</span>
		</div>
		<div class="header_my_info_fr">
			<span class="header_my_setImgBox" tapmode onclick="openWinto('user_set_win','widget://html/coupon_head',{url:'widget://html/my/set.html',name:'个人设置',islogin:true})">
				<img src="./image/my_set.png">
			</span>
			<span class="header_my_messgge" tapmode onclick="openWinto('user_msg_win','widget://html/coupon_head',{url:'widget://html/my/usermsg.html',name:'消息通知',islogin:true})">
				<img src="./image/my_message.png">
			</span>
		</div>
	</div>
	<div class="wx_wrap ">
		<div class="my_header_v4_wrap">
			<div class="my_header_v4">
				<div class="my_header_v4_main">
					<div class="my_header_v4_avatar">
						<div class="my_header_v4_avatar_img" onclick="isLogin()">
							<img src="./image/default_avatar.png" id="avatar">
						</div>
					</div>
					<div class="my_header_v4_msg">
						<div class="my_header_v4_name">
							<span class="my_header_v4_name_text" onclick="isLogin()" id="username">请登录</span>
						</div>
						<div class="my_header_name">
							<div class="my_header_v4_info">
								<img src="./image/vip.png">
								<span id="level">普通会员</span>
							</div>
							<div class="my_header_v4_pin yaoqm">
								<span id="invitation_code">绑定邀请码</span>
								<label class="copy_style_font" id="binditcode">复制</label>
							</div>
						</div>
						<div class="my_header_message" tapmode onclick="openWinto('user_msg_win','widget://html/coupon_head',{url:'widget://html/my/usermsg.html',name:'消息通知',islogin:true})">
							<img src="./image/my_message.png">
						</div>
						<div class="setImgBox" tapmode onclick="openWinto('user_set_win','widget://html/coupon_head',{url:'widget://html/my/set.html',name:'个人设置',islogin:true})">
							<img src="./image/my_set.png">
						</div>
					</div>
				</div>
				<div class="my_header_assets">
					<i>
						<span id="balance">0.00</span><label>元</label>
					</i>
					<em>每月25日提现</em>
				</div>
			</div>
		</div>

		<div class="my_header_bottom">
			<div class="my_header_left" onclick="openzhifubao()">
				<img class="zhifubaologo" src="./image/alipay_bg.png" style="position:relative;top:1px;">
				<span id="level1">设置支付宝账号</span>
			</div>
			<div class="my_header_right" tapmode onclick="openWinto('user_withdraw_win','widget://html/coupon_head',{url:'widget://html/my/tixian.html',name:'提现',islogin:true})">
				立即提现
			</div>
		</div>
		<div class="my_profit">
			<div class="my_profit_header" tapmode onclick="openWinto('getmyteam_win','widget://html/coupon_head',{url:'widget://html/my/getshourubaobiao.html',name:'收入报表',islogin:true})">
				<img src="./image/my_profit.png" class="my_profit_icon">
				<span>我的收益</span>
				<img src="./image/my_right_jt.png" class="my_profit_jt">
			</div>
			<div class="my_profit_list">
				<div class="my_profit_info">
					<span id="todaytotal">0.00</span>
					<text>
						今日预估(元)
					</text>
				</div>
				<div class="my_profit_info">
					<span id="yesterdaytotal">0.00</span>
					<text>
						昨日预估(元)
					</text>
				</div>
				<div class="my_profit_info">
					<span id="monthtotal">0.00</span>
					<text>
						本月预估(元)
					</text>
				</div>
				<div class="my_profit_info">
					<span id="lastmonthtotal">0.00</span>
					<text>
						上月预估(元)
					</text>
				</div>
			</div>
		</div>
		<div class="my_order_list">
			<div class="my_order_icon" tapmode onclick="openWinto('getmyorder_win','widget://html/coupon_head',{url:'widget://html/my/getmyorder.html',name:'我的订单',islogin:true})">
				<img src="./image/my_icon_01.png">
				<text>
					我的订单
				</text>
			</div>
			<div class="my_order_icon" tapmode onclick="openWinto('getmyteamorder_win','widget://html/coupon_head',{url:'widget://html/my/getmyteamorder.html',name:'团队订单',islogin:true})">
				<img src="./image/my_icon_02.png">
				<text>
				团队订单
				</text>
			</div>
			<div class="my_order_icon" tapmode onclick="openWinto('getmyteam_win','widget://html/coupon_head',{url:'widget://html/my/getmyteam.html',name:'我的团队',islogin:true})">
				<img src="./image/my_icon_03.png">
				<text>
					我的团队
				</text>
			</div>
			<div class="my_order_icon" tapmode onclick="openWinto('getmyteam_win','widget://html/coupon_head',{url:'widget://html/my/getshourubaobiao.html',name:'收入报表',islogin:true})">
				<img src="./image/my_icon_04.png">
				<text>
					收入报表
				</text>
			</div>
		</div>
		<div class="my_profit">
			<div class="my_profit_header">
				<img src="./image/my_tool.png" class="my_profit_icon">
				<span>实用工具</span>
			</div>
			<div class="my_profit_list">
				<div class="my_profit_info my_tools" onclick="openWinto('pyq_win','widget://html/sharepyq',{islogin:true})">
					<img src="./image/my_icon_05.png">
					<text>
						营销工具
					</text>
				</div>
				<div class="my_profit_info my_tools" onclick="openWinto('pyq_win','widget://html/sharepyq',{islogin:true})">
					<img src="./image/my_icon_08.png">
					<text>
						营销素材
					</text>
				</div>
				<div class="my_profit_info my_tools" onclick="openWinto('shareposter_win','widget://html/my/shareposter_header',{islogin:true})">
					<img src="./image/my_icon_06.png">
					<text>
						邀请好友
					</text>
				</div>
				<div class="my_profit_info my_tools" onclick="openWinto('help_win','widget://html/common_head',{name:'帮助中心',url:_URL+'help/index/admin_userid/'+ADMIN_USERID,islogin:true})">
					<img src="./image/my_icon_07.png">
					<text>
						商学院
					</text>
				</div>

			</div>
		</div>
		<div class="my_section_list">
			<div class="my_list" onclick="openWinto('user_commission_win','widget://html/coupon_head',{url:'widget://html/my/commission.html',name:'余额记录',islogin:true});">
				<img src="./image/my_icon_11.png">
				<span>余额日志</span>
			</div>
			<div class="my_list" onclick="openWinto('collection_win','widget://html/coupon_head',{url:'widget://html/my/collection.html',name:'我的收藏',islogin:true})">
				<img src="./image/my_icon_10.png">
				<span>我的收藏</span>
			</div>
			<div class="my_list" onclick="openWinto('shareposter_win','widget://html/my/shareposter_header',{islogin:true})">
				<img src="./image/my_icon_09.png">
				<span>邀请好友</span>
			</div>
			<div class="my_list" onclick="getUserData({name:'联系我们',apiname:'getContactus'})">
				<img src="./image/my_icon_12.png">
				<span>联系我们</span>
			</div>
		</div>
	</div>
	<section id="diycontent"></section>
	<!--绑定邀请码-->
	<div class="yqmbox">
		<div class="yqmbox_bg"></div>
		<div class="yqm_content">
			<div class="hbcloses" style="display:none;">
				<img src="./image/guanbi.png">
			</div>
			<img src="./image/bindinvcode.jpg" class="yqm_img" />
			<div class="binding_yqm">绑定邀请码<span>（绑定邀请码后无法修改）</span></div>
			<div class="login_input">
				<img src="./image/login_03.png">
				<input type="text" placeholder="请输入邀请码" id="bindInvitation_code" class="login_phone" value="4001">
			</div>
			<div class="login_btn" onclick="bindInvitationCode()">
				<span>确认绑定</span>
			</div>
		</div>
	</div>
	<!-- 支付宝弹窗 -->
	<div class="indexbanner zhifubaotanbox" style="display:none;">
		<div class="mask_close" onclick="closezhifubao();" style="top:11%;">
			<img src="./image/guanbi.png">
		</div>
		<div class="contenttop_js">
			<div class="share_photo" style="width: 80%;">
				<div class="imgDetailBox" style="padding:0;position: relative;">
					<img id="poster" style="border-radius:8px;" src="./image/alipay_back.png">
					<div class="inputbox" style="position: absolute;top: 60%;width: 80%;left: 10%;">
						<div class="inputbox1" style="overflow:hidden;">
							<div class="inputbox2 top">
								<div class="imgbox">
									<img src="./image/name.png" alt="">
								</div>
								<div class="inputtext linebottom">
									<input type="text" class="realname" placeholder-style="font-size:18px;" placeholder="请输入您的真实姓名">
								</div>
							</div>
							<div class="inputbox2 linebottom bottom">
								<input type="text " class="alipayno" placeholder-style="font-size:18px;" placeholder="请输入您的支付宝账号">
							</div>
						</div>
						<div class="buttonbox">
							<span onclick="doclickzhifubao();">确定</span>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>
	<!-- 指示弹窗 -->
	<div class="indexbanner zhishitanchuang" onclick="closezhishitanchuang();" style="background: rgba(51, 51, 51, 0.4);">

		<div class="zhishibox">
			<img class="img" src="./image/airplay.png" alt="">
			<div>为了不影响奖励发放请设置支付宝账号</div>
		</div>
	</div>
	<script id="diy_mycenter" type="text/x-dot-template">
		{{? it && it.list!='' && it.list.length>0}} {{ for(var i=0, catlen=it.list.length; i
		<catlen; i++) {}} <div class="swiper-slide img_style">
			<img src="{{=it.list[i].img}}" style="max-height:193px;" onclick='diyopenpage(this)' diyouturltype='{{=it.list[i].outurltype}}' diylevel='{{=it.list[i].level}}' diyname='{{=it.list[i].name}}' diyurl='{{=it.list[i].url}}' diyouturl='{{=it.list[i].outurl}}'>
			</div>
			{{}}} {{}}}
	</script>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../script/zepto.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript">
	var user;
	apiready = function() {
		user = isLogin();
		if (user) {
			//绑定极光推送用户
			var ajpush = api.require('ajpush');
			var param = {
				alias: 'userid'+user.id,
				tags: ["level" + user.level_name]
			};
			ajpush.bindAliasAndTags(param, function(ret) {
				var statusCode = ret.statusCode;
				console.log("绑定极光推送用户别名+组：" + statusCode);
			});
			showProgress();
			getMemberInfo();
			getDiyContent();
		}
	};
	$(document).ready(function() {

	});

	function getUserData(param) {
		openWinto('user_center_win', 'widget://html/common_head', {
			name: param.name,
			url: URL + 'Help/' + param.apiname,
			islogin: true,
			headers: {
				'Login-devid': api.deviceId,
			}
		});
	}

	function getMemberInfo() {
		getUserAllInfo(function(ret, err) {
			hideProgress();
			if (ret && ret.code == 1) {
				$("#username").text(ret.data.realname || ret.data.username || ret.data.taobao_user_nick || ret.data.wxnick || ret.data.qqnick || ret.data.mobile);
				$("#username_top").text(ret.data.realname || ret.data.username || ret.data.taobao_user_nick || ret.data.wxnick || ret.data.qqnick || ret.data.mobile);
				$("#balance").text((ret.data.user_money * 1).toFixed(2));
				$("#level").text(ret.data.level_name);
				// 判断是否填了支付宝
				$('.realname').val(ret.data.realname);
				$('.alipayno').val(ret.data.alipay);
				if (ret.data.realname && ret.data.alipay) {
					$('.zhifubaologo').attr('src', './image/alipay.png');
					$('#level1').text('支付宝账号设置');
				} else {
					$('.zhishitanchuang').show();
				}
				if (!ret.data.userpid) {
					getYqmCode();
				}
				if (ret.data.avatar) {
					$("#avatar").attr("src", ret.data.avatar);
					$("#avatar_t").attr("src", ret.data.avatar);
				}
				$("#invitation_code").text(parseInt(ret.data.id) + 4000);
				$(".copy_style_font").show();
				postDataLogin('getMyIncome', {}, function(rets) {
					$("#todaytotal").text((rets.data.mydata.today_myincome * 1 + rets.data.myteamdata.today_myteam_income * 1).toFixed(2));
					$("#yesterdaytotal").text((rets.data.mydata.yesterday_myincome * 1 + rets.data.myteamdata.yesterday_myteam_income * 1).toFixed(2));
					$("#monthtotal").text((rets.data.mydata.month_myincome * 1 + rets.data.myteamdata.month_myteam_income * 1).toFixed(2));
					$("#lastmonthtotal").text((rets.data.mydata.lastmonth_myincome * 1 + rets.data.myteamdata.lastmonth_myteam_income * 1).toFixed(2));
				});
			}
		});
	}

	function copyword(invitation_code) {
		var clipBoard = api.require('clipBoard');
		clipBoard.set({
			value: invitation_code
		}, function(ret, err) {
			if (ret) {
				showToast('复制成功!');
			} else {
				showToast('复制失败!');
			}
		});
	}
</script>
<script type="text/javascript">
	$(function() {
		$('.header_my_info').hide();
		$(window).scroll(function() {
			if ($(window).scrollTop() > 150) {
				$('.header_my_info').show();
			} else {
				$('.header_my_info').hide();
			}
		});
	});
	$("#binditcode").click(function() {
		if (user.id) {
			copyword('Tip：' + parseInt(user.id * 1 + 4000));
			return;
		}
	});


	function closezhifubao() {
		$('.zhifubaotanbox').hide();
	}

	function openzhifubao() {
		if (isLogin()) {
			$('.zhifubaotanbox').show();
		}
	}

	function closezhishitanchuang() {
		$('.zhishitanchuang').hide();
	}

	function doclickzhifubao() {
		var realname = $('.realname').val().trim();
		var alipayno = $('.alipayno').val().trim();
		if (realname == '') {
			api.toast({
				msg: '请输入您的真实姓名!',
				duration: 2000,
				location: 'bottom'
			});
			return;
		}
		if (alipayno == '') {
			api.toast({
				msg: '请输入您的支付宝账号!',
				duration: 2000,
				location: 'bottom'
			});
			return;
		}
		var datauser = new Object();
		datauser.realname = realname;
		datauser.alipay = alipayno;
		datauser.id = isLogin().id;
		postData(_URL + 'User/updateUserInfo', datauser, function(ret) {
			if (ret) {
				showToast(ret.data);
				setTimeout(function() {
					$('.zhifubaotanbox').hide();
				}, 2000);
				getMemberInfo();
			} else {
				showToast('系统繁忙~');
			}
		});
	}

	function getYqmCode() {
		var dialogBox = api.require('dialogBox');
		dialogBox.inputbox({
			tapClose: false,
			keyboardType: 'number',
			texts: {
				title: '',
				placeholder: '请输入邀请码',
				default: '',//parseInt(user.id) + 4000,
				leftBtnTitle: '取消',
				rightBtnTitle: '确定'
			},
			styles: {
				bg: 'widget://html/my/image/inputbg.png',
				corner: 3,
				w: 300,
				h: 240,
				bottomBtnMarginB: 20,
				title: {
					h: 30,
					alignment: 'center',
					size: 14,
					color: '#000',
					marginT: 15,
				},
				input: {
					h: 40,
					marginT: 50,
					marginLeft: 50,
					marginRight: 50,
					textSize: 24,
					textColor: '#000',
					borderColor: '#ddd',
					borderWidth: 1,
					verticalCenter: true
				},
				dividingLine: {
					width: 0,
					color: '#696969'
				},
				left: {
					bg: '#ddd',
					color: '#FFF',
					size: 12,
					h: 35,
					w: 90,
					corner: 3,
					leftMargin: 20
				},
				right: {
					bg: '#A152CA',
					color: '#FFF',
					size: 12,
					h: 35,
					w: 90,
					corner: 3,
					rightMargin: 20
				}
			}
		}, function(ret) {
			if (ret.eventType == 'left') {
				closeDialogBox('inputbox');
			} else if (ret.eventType == 'right') {
				if (ret.text == '') {
					showToast('请输入邀请码~', 'bottom');
				} else if (typeof parseInt(ret.text) === 'number' && !isNaN(ret.text)) {
					postData(_URL + 'User/updateUserInfo', {
						'id': user.id,
						'userpid': parseInt(ret.text) - 4000
					}, function(rets, err) {
						if (rets.code == 1 && rets.data !== -1) {
							closeDialogBox('inputbox');
							showToast(rets.data, 'bottom');
							getMemberInfo();
						} else {
							showToast('邀请码不正确!', 'bottom');
						}
					});
				} else {
					showToast('请输入正确的邀请码(数字)~', 'bottom');
				}
			}
		});
	}
</script>

</html>
